package com.cloud.phone.task.bean;

import com.cloud.phone.constants.Constants;
import com.cloud.phone.utils.ProxyUtils;

import java.io.Serializable;
import java.util.List;

public class FirstSyncServerData implements Serializable {

    /**
     * data : {"ip":{"ip":"161.77.1.48","account":"uhrmacherorrell","password":"RQ2E8qInxj","port":50101,"id":null,"ipId":null},"msgs":null}
     * code : 0
     * message : 成功
     * error : null
     */

    private DataBean data;
    private Integer code;
    private String message;

    public DataBean getData() {
        return data;
    }

    public void setData(DataBean data) {
        this.data = data;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }


    public static class DataBean implements Serializable {
        /**
         * ip : {"ip":"161.77.1.48","account":"uhrmacherorrell","password":"RQ2E8qInxj","port":50101,"id":null,"ipId":null}
         * msgs : null
         */

        private IpBean ip;

        public void initIpConfig(){
            if(ip==null){
                return;
            }
            String proxyUrl = ProxyUtils.INSTANCE.ProxySocks(
                    ip.account,
                    ip.password,
                    ip.ip,
                    ip.port
            );
            Constants.PROXY_SOCKS_URL = proxyUrl;
            ProxyUtils.INSTANCE.setSocksUrl(proxyUrl);
            ProxyUtils.INSTANCE.setProxyIp(ip.ip);
        }


        private List<ChatMsgList> msgs;

        public IpBean getIp() {
            return ip;
        }

        public void setIp(IpBean ip) {
            this.ip = ip;
        }

        public List<ChatMsgList> getMsgs() {
            return msgs;
        }

        public void setMsgs(List<ChatMsgList> msgs) {
            this.msgs = msgs;
        }

        public static class IpBean implements Serializable {
            /**
             * ip : 161.77.1.48
             * account : uhrmacherorrell
             * password : RQ2E8qInxj
             * port : 50101
             * id : null
             * ipId : null
             */

            private String ip;
            private String account;
            private String password;
            private int port;
            private Object id;
            private Object ipId;

            public String getIp() {
                return ip;
            }

            public void setIp(String ip) {
                this.ip = ip;
            }

            public String getAccount() {
                return account;
            }

            public void setAccount(String account) {
                this.account = account;
            }

            public String getPassword() {
                return password;
            }

            public void setPassword(String password) {
                this.password = password;
            }

            public int getPort() {
                return port;
            }

            public void setPort(int port) {
                this.port = port;
            }

            public Object getId() {
                return id;
            }

            public void setId(Object id) {
                this.id = id;
            }

            public Object getIpId() {
                return ipId;
            }

            public void setIpId(Object ipId) {
                this.ipId = ipId;
            }
        }
    }
}
